package com.spider.demo;
//智能家居控制类
public class SmartHomeControl {
    private static final SmartHomeControl shc = new SmartHomeControl();
    private SmartHomeControl() {
    }
    public static SmartHomeControl getInstance() {
        return shc;
    }


    public void control(JD jds) {
        System.out.println("开始操作：");
        System.out.println(jds.getName() + "开关："+ (jds.isStatus()?"开":"关"));
        jds.press();
        System.out.println(jds.getName() + "开关："+ (jds.isStatus()?"开":"关"));
    }

    public void printAllStatus(JD[] jds) {
        for (int i = 0; i < jds.length; i++){
            JD j = jds[i];
            System.out.println((i+1)+" "+j.getName() + "开关：" + (j.isStatus()?"开":"关"));
        }

    }
}
